//-----------------------------------------------------------------------------
//
//	MONOGRAM GraphStudio
//
//	Author : Igor Janos
//
//-----------------------------------------------------------------------------
#include "stdafx.h"
#include <asferr.h>
#include <nserror.h>
#include <uuids.h>

// from dxva2api.h
#ifndef DXVA2_API_DEFINED
#define DXVA2_E_NOT_INITIALIZED     ((HRESULT)0x80041000L)
#define DXVA2_E_NEW_VIDEO_DEVICE    ((HRESULT)0x80041001L)
#define DXVA2_E_VIDEO_DEVICE_LOCKED ((HRESULT)0x80041002L)
#define DXVA2_E_NOT_AVAILABLE       ((HRESULT)0x80041003L)
#endif

namespace GraphStudio
{

#define	KNOWN(x)			{ x, _T( # x ) }
	struct GuidPair {
		GUID	guid; 
		LPCTSTR	name;
	};

	const GuidPair	KnownGuidList[] = 
	{
		// filters
		KNOWN(CLSID_AsyncReader),
		KNOWN(GUID_NULL),

		// Media Types
		KNOWN(MEDIATYPE_AnalogAudio),
		KNOWN(MEDIATYPE_AnalogVideo),
		KNOWN(MEDIATYPE_Audio),
		KNOWN(MEDIATYPE_AUXLine21Data),
        KNOWN(MEDIATYPE_AUXTeletextPage),
        KNOWN(MEDIATYPE_CC_CONTAINER),
		KNOWN(MEDIATYPE_DTVCCData),
		KNOWN(MEDIATYPE_DVD_ENCRYPTED_PACK),
		KNOWN(MEDIATYPE_DVD_NAVIGATION),
		KNOWN(MEDIATYPE_File),
		KNOWN(MEDIATYPE_Interleaved),
		KNOWN(MEDIATYPE_LMRT),
		KNOWN(MEDIATYPE_Midi),
		KNOWN(MEDIATYPE_MPEG1SystemStream),
		KNOWN(MEDIATYPE_MPEG2_PACK),
		KNOWN(MEDIATYPE_MPEG2_PES),
        KNOWN(MEDIATYPE_MPEG2_SECTIONS),
		KNOWN(MEDIATYPE_MSTVCaption),
		KNOWN(MEDIATYPE_NULL),
		KNOWN(MEDIATYPE_ScriptCommand),
		KNOWN(MEDIATYPE_Stream),
		KNOWN(MEDIATYPE_Text),
		KNOWN(MEDIATYPE_Timecode),
		KNOWN(MEDIATYPE_URL_STREAM),
		KNOWN(MEDIATYPE_VBI),
		KNOWN(MEDIATYPE_Video),

        // Stream Subtypes
        KNOWN(MEDIASUBTYPE_AIFF),
        KNOWN(MEDIASUBTYPE_Asf),
        KNOWN(MEDIASUBTYPE_Avi),
        KNOWN(MEDIASUBTYPE_AU),
        KNOWN(MEDIASUBTYPE_DssAudio),
		KNOWN(MEDIASUBTYPE_DssVideo),
        KNOWN(MEDIASUBTYPE_MPEG1Audio),
        KNOWN(MEDIASUBTYPE_MPEG1System),
        KNOWN(MEDIASUBTYPE_MPEG1Video),
        KNOWN(MEDIASUBTYPE_MPEG1VideoCD),
        KNOWN(MEDIASUBTYPE_WAVE),

        // VBI Media Types
        KNOWN(KSDATAFORMAT_SUBTYPE_RAW8),
        KNOWN(MEDIASUBTYPE_TELETEXT),
        KNOWN(MEDIASUBTYPE_VPS),
        KNOWN(MEDIASUBTYPE_WSS),

        // Video Subtypes (Analog)
        KNOWN(MEDIASUBTYPE_AnalogVideo_NTSC_M),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_B),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_D),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_G),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_H),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_I),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_M),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_N),
		KNOWN(MEDIASUBTYPE_AnalogVideo_PAL_N_COMBO),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_B),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_D),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_G),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_H),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_K),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_K1),
		KNOWN(MEDIASUBTYPE_AnalogVideo_SECAM_L),

        // Video Subtypes (DXVA)
        KNOWN(MEDIASUBTYPE_AI44),
        KNOWN(MEDIASUBTYPE_IA44),

        // Video Subtypes (DV)
        KNOWN(MEDIASUBTYPE_dvsl),
        KNOWN(MEDIASUBTYPE_dvsd),
        KNOWN(MEDIASUBTYPE_DVSD),
        KNOWN(MEDIASUBTYPE_dvhd),
        KNOWN(MEDIASUBTYPE_MDVF),
        KNOWN(MEDIASUBTYPE_dv25),
		KNOWN(MEDIASUBTYPE_dv50),
		KNOWN(MEDIASUBTYPE_DVCS),

        // Video Subtypes (h264)
        KNOWN(MEDIASUBTYPE_AVC1),
        KNOWN(MEDIASUBTYPE_H264),
        KNOWN(MEDIASUBTYPE_h264),
        KNOWN(MEDIASUBTYPE_X264),
        KNOWN(MEDIASUBTYPE_x264),

        // Video Subtypes (Uncompressd RGB)
        KNOWN(MEDIASUBTYPE_RGB1),
        KNOWN(MEDIASUBTYPE_RGB4),
        KNOWN(MEDIASUBTYPE_RGB8),
        KNOWN(MEDIASUBTYPE_RGB555),
        KNOWN(MEDIASUBTYPE_RGB565),
        KNOWN(MEDIASUBTYPE_RGB24),
		KNOWN(MEDIASUBTYPE_RGB32),
        KNOWN(MEDIASUBTYPE_ARGB1555),
        KNOWN(MEDIASUBTYPE_ARGB1555_D3D_DX7_RT),
		KNOWN(MEDIASUBTYPE_ARGB1555_D3D_DX9_RT),
        KNOWN(MEDIASUBTYPE_ARGB32),
        KNOWN(MEDIASUBTYPE_ARGB32_D3D_DX7_RT),
		KNOWN(MEDIASUBTYPE_ARGB32_D3D_DX9_RT),
		KNOWN(MEDIASUBTYPE_ARGB4444),
		KNOWN(MEDIASUBTYPE_ARGB4444_D3D_DX7_RT),
		KNOWN(MEDIASUBTYPE_ARGB4444_D3D_DX9_RT),
        KNOWN(MEDIASUBTYPE_A2B10G10R10),
		KNOWN(MEDIASUBTYPE_A2R10G10B10),

        // Video Subtypes (YUV)
        KNOWN(MEDIASUBTYPE_AYUV),
        KNOWN(MEDIASUBTYPE_YUY2),
        KNOWN(MEDIASUBTYPE_UYVY),
        KNOWN(MEDIASUBTYPE_IMC1),
		KNOWN(MEDIASUBTYPE_IMC2),
		KNOWN(MEDIASUBTYPE_IMC3),
		KNOWN(MEDIASUBTYPE_IMC4),
        KNOWN(MEDIASUBTYPE_YV12),
        KNOWN(MEDIASUBTYPE_NV12),
		KNOWN(MEDIASUBTYPE_NV24),
        KNOWN(MEDIASUBTYPE_I420),
        KNOWN(MEDIASUBTYPE_IF09),
        KNOWN(MEDIASUBTYPE_IYUV),
        KNOWN(MEDIASUBTYPE_Y211),
		KNOWN(MEDIASUBTYPE_Y411),
		KNOWN(MEDIASUBTYPE_Y41P),
        KNOWN(MEDIASUBTYPE_YUYV),
		KNOWN(MEDIASUBTYPE_YVU9),
		KNOWN(MEDIASUBTYPE_YVYU),

        // Video Subtypes (MJPEG)
        KNOWN(MEDIASUBTYPE_MJPG),
        KNOWN(MEDIASUBTYPE_IJPG),
        KNOWN(MEDIASUBTYPE_CFCC),
        KNOWN(MEDIASUBTYPE_Plum),
        KNOWN(MEDIASUBTYPE_TVMJ),

        // Video Subtypes QT
        KNOWN(MEDIASUBTYPE_QTJpeg),
		KNOWN(MEDIASUBTYPE_QTMovie),
		KNOWN(MEDIASUBTYPE_QTRle),
		KNOWN(MEDIASUBTYPE_QTRpza),
		KNOWN(MEDIASUBTYPE_QTSmc),

		// Video SubTypes (misc.)
		KNOWN(MEDIASUBTYPE_CLJR),
		KNOWN(MEDIASUBTYPE_CLPL),
		KNOWN(MEDIASUBTYPE_CPLA),
        KNOWN(MEDIASUBTYPE_Overlay),
        KNOWN(MEDIASUBTYPE_VPVBI),
		KNOWN(MEDIASUBTYPE_VPVideo),

        // Audio Subtypes
        KNOWN(MEDIASUBTYPE_IEEE_FLOAT),
        KNOWN(MEDIASUBTYPE_PCM),
        KNOWN(MEDIASUBTYPE_MPEG_ADTS_AAC),
        KNOWN(MEDIASUBTYPE_MPEG_HEAAC),
        KNOWN(MEDIASUBTYPE_MPEG_LOAS),
        KNOWN(MEDIASUBTYPE_RAW_AAC1),
        KNOWN(MEDIASUBTYPE_DOLBY_DDPLUS),
        KNOWN(MEDIASUBTYPE_DOLBY_AC3),
		KNOWN(MEDIASUBTYPE_DOLBY_AC3_SPDIF),
        KNOWN(MEDIASUBTYPE_DVM),
        KNOWN(MEDIASUBTYPE_RAW_SPORT),
        KNOWN(MEDIASUBTYPE_SPDIF_TAG_241h),
		KNOWN(MEDIASUBTYPE_DRM_Audio),
		KNOWN(MEDIASUBTYPE_DTS),
        KNOWN(MEDIASUBTYPE_DTS2),
		
        // Mpeg Subtypes
		KNOWN(MEDIASUBTYPE_MPEG1AudioPayload),
		KNOWN(MEDIASUBTYPE_MPEG1Packet),
		KNOWN(MEDIASUBTYPE_MPEG1Payload),
		KNOWN(MEDIASUBTYPE_MPEG2_AUDIO),
		KNOWN(MEDIASUBTYPE_MPEG2_PROGRAM),
		KNOWN(MEDIASUBTYPE_MPEG2_TRANSPORT),
		KNOWN(MEDIASUBTYPE_MPEG2_TRANSPORT_STRIDE),
		KNOWN(MEDIASUBTYPE_MPEG2_UDCR_TRANSPORT),
		KNOWN(MEDIASUBTYPE_MPEG2_VIDEO),
		KNOWN(MEDIASUBTYPE_MPEG2_WMDRM_TRANSPORT),
        KNOWN(MEDIASUBTYPE_DVD_LPCM_AUDIO),
		KNOWN(MEDIASUBTYPE_DVD_NAVIGATION_DSI),
		KNOWN(MEDIASUBTYPE_DVD_NAVIGATION_PCI),
		KNOWN(MEDIASUBTYPE_DVD_NAVIGATION_PROVIDER),
		KNOWN(MEDIASUBTYPE_DVD_SUBPICTURE),

        KNOWN(MEDIASUBTYPE_Line21_BytePair),
		KNOWN(MEDIASUBTYPE_Line21_GOPPacket),
		KNOWN(MEDIASUBTYPE_Line21_VBIRawData),
	
		// Formats
		KNOWN(FORMAT_525WSS),
		KNOWN(FORMAT_AnalogVideo),
		KNOWN(FORMAT_DolbyAC3),
		KNOWN(FORMAT_DVD_LPCMAudio),
		KNOWN(FORMAT_DvInfo),
		KNOWN(FORMAT_MPEG2_VIDEO),
		KNOWN(FORMAT_MPEG2Audio),
		KNOWN(FORMAT_MPEG2Video),
		KNOWN(FORMAT_MPEGStreams),
		KNOWN(FORMAT_MPEGVideo),
		KNOWN(FORMAT_None),
		KNOWN(FORMAT_VideoInfo),
		KNOWN(FORMAT_VIDEOINFO2),
		KNOWN(FORMAT_VideoInfo2),
		KNOWN(FORMAT_WaveFormatEx),

		// Wave formats
		KNOWN(KSDATAFORMAT_SUBTYPE_PCM),
		KNOWN(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT),
		KNOWN(KSDATAFORMAT_SUBTYPE_DRM),
		KNOWN(KSDATAFORMAT_SUBTYPE_ALAW),
		KNOWN(KSDATAFORMAT_SUBTYPE_MULAW),
		KNOWN(KSDATAFORMAT_SUBTYPE_ADPCM),

        // misc.
        KNOWN(MEDIASUBTYPE_DtvCcData),
		KNOWN(MEDIASUBTYPE_S340),
		KNOWN(MEDIASUBTYPE_S342),
		KNOWN(MEDIASUBTYPE_SDDS),
		KNOWN(MEDIASUBTYPE_dvh1),
		KNOWN(MEDIASUBTYPE_IF09),

        KNOWN(MEDIASUBTYPE_None),
		KNOWN(MEDIASUBTYPE_NULL),

        // From WMCodecdsp.h
        KNOWN(MEDIASUBTYPE_V216),
        KNOWN(MEDIASUBTYPE_V410),
        KNOWN(MEDIASUBTYPE_v210),
        KNOWN(MEDIASUBTYPE_I420),
        KNOWN(MEDIASUBTYPE_WVC1),
        KNOWN(MEDIASUBTYPE_wvc1),
        KNOWN(MEDIASUBTYPE_WMVA),
        KNOWN(MEDIASUBTYPE_wmva),
        KNOWN(MEDIASUBTYPE_WMVB),
        KNOWN(MEDIASUBTYPE_wmvb),
        KNOWN(MEDIASUBTYPE_WMVR),
        KNOWN(MEDIASUBTYPE_wmvr),
        KNOWN(MEDIASUBTYPE_WMVP),
        KNOWN(MEDIASUBTYPE_wmvp),
        KNOWN(MEDIASUBTYPE_WVP2),
        KNOWN(MEDIASUBTYPE_wvp2),
        KNOWN(MEDIASUBTYPE_WMV3),
        KNOWN(MEDIASUBTYPE_wmv3),
        KNOWN(MEDIASUBTYPE_WMV2),
        KNOWN(MEDIASUBTYPE_wmv2),
        KNOWN(MEDIASUBTYPE_WMV1),
        KNOWN(MEDIASUBTYPE_wmv1),
        KNOWN(MEDIASUBTYPE_MPG4),
        KNOWN(MEDIASUBTYPE_mpg4),
        KNOWN(MEDIASUBTYPE_MP42),
        KNOWN(MEDIASUBTYPE_mp42),
        KNOWN(MEDIASUBTYPE_MP43),
        KNOWN(MEDIASUBTYPE_mp43),
        KNOWN(MEDIASUBTYPE_MP4S),
        KNOWN(MEDIASUBTYPE_mp4s),
        KNOWN(MEDIASUBTYPE_M4S2),
        KNOWN(MEDIASUBTYPE_m4s2),
        KNOWN(MEDIASUBTYPE_MSS1),
        KNOWN(MEDIASUBTYPE_MSS2),
        KNOWN(MEDIASUBTYPE_MSAUDIO1),
        KNOWN(MEDIASUBTYPE_WMAUDIO2),
        KNOWN(MEDIASUBTYPE_WMAUDIO3),
        KNOWN(MEDIASUBTYPE_WMAUDIO_LOSSLESS),
        KNOWN(MEDIASUBTYPE_WMASPDIF),
        KNOWN(MEDIASUBTYPE_WMAUDIO4),
        KNOWN(MEDIASUBTYPE_MPEG_ADTS_AAC),
        KNOWN(MEDIASUBTYPE_MPEG_RAW_AAC),
        KNOWN(MEDIASUBTYPE_MPEG_LOAS),
        KNOWN(MEDIASUBTYPE_NOKIA_MPEG_ADTS_AAC),
        KNOWN(MEDIASUBTYPE_NOKIA_MPEG_RAW_AAC),
        KNOWN(MEDIASUBTYPE_VODAFONE_MPEG_ADTS_AAC),
        KNOWN(MEDIASUBTYPE_VODAFONE_MPEG_RAW_AAC),
        KNOWN(MEDIASUBTYPE_MPEG_HEAAC),
        KNOWN(MEDIASUBTYPE_RAW_AAC1),
        KNOWN(MEDIASUBTYPE_DVM),
        KNOWN(MEDIASUBTYPE_DTS2),
        KNOWN(MEDIASUBTYPE_DOLBY_DDPLUS),
        KNOWN(MEDIASUBTYPE_DOLBY_TRUEHD),
        KNOWN(MEDIASUBTYPE_DTS_HD),

        // Moreuuids.h
        KNOWN(MEDIASUBTYPE_WAVE_DOLBY_AC3),
        KNOWN(MEDIASUBTYPE_LATM_AAC),
        KNOWN(MEDIASUBTYPE_MP4A),
        KNOWN(MEDIASUBTYPE_mp4a),
        KNOWN(MEDIASUBTYPE_MP3),
        KNOWN(MEDIASUBTYPE_FLAC),
        KNOWN(MEDIASUBTYPE_FLAC_FRAMED),
        KNOWN(MEDIASUBTYPE_TTA1),
        KNOWN(MEDIASUBTYPE_WAVPACK4),
        KNOWN(MEDIASUBTYPE_AMR),
        KNOWN(MEDIASUBTYPE_SAMR),
        KNOWN(MEDIASUBTYPE_VP80),
        KNOWN(MEDIASUBTYPE_IMA4),
        KNOWN(MEDIASUBTYPE_SAWB),
        KNOWN(MEDIASUBTYPE_SVCD_SUBPICTURE),
        KNOWN(MEDIASUBTYPE_CVD_SUBPICTURE),
        KNOWN(MEDIASUBTYPE_MPEG2_PVA),
        KNOWN(MEDIASUBTYPE_DirectShowMedia),
        KNOWN(MEDIASUBTYPE_Dirac),
        KNOWN(MEDIASUBTYPE_DiracVideo),
        KNOWN(FORMAT_DiracVideoInfo),
        KNOWN(MEDIASUBTYPE_MP4),
        KNOWN(MEDIASUBTYPE_FLV),
        KNOWN(MEDIASUBTYPE_FLV1),
        KNOWN(MEDIASUBTYPE_flv1),
        KNOWN(MEDIASUBTYPE_FLV4),
        KNOWN(MEDIASUBTYPE_flv4),
        KNOWN(MEDIASUBTYPE_VP50),
        KNOWN(MEDIASUBTYPE_vp50),
        KNOWN(MEDIASUBTYPE_VP60),
        KNOWN(MEDIASUBTYPE_vp60),
        KNOWN(MEDIASUBTYPE_VP61),
        KNOWN(MEDIASUBTYPE_vp61),
        KNOWN(MEDIASUBTYPE_VP62),
        KNOWN(MEDIASUBTYPE_vp62),
        KNOWN(MEDIASUBTYPE_VP6A),
        KNOWN(MEDIASUBTYPE_vp6a),
        KNOWN(MEDIASUBTYPE_VP6F),
        KNOWN(MEDIASUBTYPE_vp6f),
        KNOWN(MEDIASUBTYPE_RealMedia),
        KNOWN(MEDIASUBTYPE_RV10),
        KNOWN(MEDIASUBTYPE_RV20),
        KNOWN(MEDIASUBTYPE_RV30),
        KNOWN(MEDIASUBTYPE_RV40),
        KNOWN(MEDIASUBTYPE_RV41),
        KNOWN(MEDIASUBTYPE_14_4),
        KNOWN(MEDIASUBTYPE_28_8),
        KNOWN(MEDIASUBTYPE_ATRC),
        KNOWN(MEDIASUBTYPE_COOK),
        KNOWN(MEDIASUBTYPE_DNET),
        KNOWN(MEDIASUBTYPE_SIPR),
        KNOWN(MEDIASUBTYPE_RAAC),
        KNOWN(MEDIASUBTYPE_RACP),
        KNOWN(MEDIASUBTYPE_PCM_NONE),
        KNOWN(MEDIASUBTYPE_PCM_RAW),
        KNOWN(MEDIASUBTYPE_PCM_TWOS),
        KNOWN(MEDIASUBTYPE_PCM_SOWT),
        KNOWN(MEDIASUBTYPE_PCM_IN24),
        KNOWN(MEDIASUBTYPE_PCM_IN32),
        KNOWN(MEDIASUBTYPE_PCM_FL32),
        KNOWN(MEDIASUBTYPE_PCM_FL64),
        KNOWN(MEDIASUBTYPE_PCM_IN24_le),
        KNOWN(MEDIASUBTYPE_PCM_IN32_le),
        KNOWN(MEDIASUBTYPE_PCM_FL32_le),
        KNOWN(MEDIASUBTYPE_PCM_FL64_le),
        KNOWN(MEDIASUBTYPE_PS2_PCM),
        KNOWN(MEDIASUBTYPE_PS2_ADPCM),
        KNOWN(MEDIASUBTYPE_PS2_SUB),
        KNOWN(MEDIASUBTYPE_Ogg),
        KNOWN(MEDIASUBTYPE_Vorbis),
        KNOWN(FORMAT_VorbisFormat),
        KNOWN(MEDIASUBTYPE_Vorbis2),
        KNOWN(FORMAT_VorbisFormat2),
        KNOWN(MEDIASUBTYPE_Matroska),
        KNOWN(MEDIATYPE_Subtitle),
        KNOWN(MEDIASUBTYPE_UTF8),
        KNOWN(MEDIASUBTYPE_SSA),
        KNOWN(MEDIASUBTYPE_ASS),
        KNOWN(MEDIASUBTYPE_ASS2),
        KNOWN(MEDIASUBTYPE_SSF),
        KNOWN(MEDIASUBTYPE_USF),
        KNOWN(MEDIASUBTYPE_VOBSUB),
        KNOWN(FORMAT_SubtitleInfo),
        KNOWN(MEDIASUBTYPE_HDMVSUB),
        KNOWN(MEDIASUBTYPE_ArcsoftH264),
        KNOWN(MEDIASUBTYPE_VSSH),
        KNOWN(MEDIASUBTYPE_vssh),
        KNOWN(MEDIASUBTYPE_DAVC),
        KNOWN(MEDIASUBTYPE_davc),
        KNOWN(MEDIASUBTYPE_PAVC),
        KNOWN(MEDIASUBTYPE_pavc),
        KNOWN(MEDIASUBTYPE_avc1),
        KNOWN(MEDIASUBTYPE_CCV1),
        KNOWN(MEDIASUBTYPE_H264_bis),
        KNOWN(MEDIASUBTYPE_SVQ3),
        KNOWN(MEDIASUBTYPE_XVID),
        KNOWN(MEDIASUBTYPE_xvid),
        KNOWN(MEDIASUBTYPE_DX50),
        KNOWN(MEDIASUBTYPE_dx50),
        KNOWN(MEDIASUBTYPE_DIVX),
        KNOWN(MEDIASUBTYPE_divx),
        KNOWN(MEDIASUBTYPE_MP4V),
        KNOWN(MEDIASUBTYPE_mp4v),
        KNOWN(MEDIASUBTYPE_3IV1),
        KNOWN(MEDIASUBTYPE_3iv1),
        KNOWN(MEDIASUBTYPE_3IV2),
        KNOWN(MEDIASUBTYPE_3iv2),
        KNOWN(MEDIASUBTYPE_3IVX),
        KNOWN(MEDIASUBTYPE_3ivx),
        KNOWN(MEDIASUBTYPE_BLZ0),
        KNOWN(MEDIASUBTYPE_blz0),
        KNOWN(MEDIASUBTYPE_DM4V),
        KNOWN(MEDIASUBTYPE_dm4v),
        KNOWN(MEDIASUBTYPE_DXGM),
        KNOWN(MEDIASUBTYPE_dxgm),
        KNOWN(MEDIASUBTYPE_FFDS),
        KNOWN(MEDIASUBTYPE_ffds),
        KNOWN(MEDIASUBTYPE_FVFW),
        KNOWN(MEDIASUBTYPE_fvfw),
        KNOWN(MEDIASUBTYPE_FMP4),
        KNOWN(MEDIASUBTYPE_fmp4),
        KNOWN(MEDIASUBTYPE_HDX4),
        KNOWN(MEDIASUBTYPE_hdx4),
        KNOWN(MEDIASUBTYPE_LMP4),
        KNOWN(MEDIASUBTYPE_lmp4),
        KNOWN(MEDIASUBTYPE_NDIG),
        KNOWN(MEDIASUBTYPE_ndig),
        KNOWN(MEDIASUBTYPE_RMP4),
        KNOWN(MEDIASUBTYPE_rmp4),
        KNOWN(MEDIASUBTYPE_SMP4),
        KNOWN(MEDIASUBTYPE_smp4),
        KNOWN(MEDIASUBTYPE_SEDG),
        KNOWN(MEDIASUBTYPE_sedg),
        KNOWN(MEDIASUBTYPE_UMP4),
        KNOWN(MEDIASUBTYPE_ump4),
        KNOWN(MEDIASUBTYPE_WV1F),
        KNOWN(MEDIASUBTYPE_wv1f),
        KNOWN(MEDIASUBTYPE_XVIX),
        KNOWN(MEDIASUBTYPE_xvix),
        KNOWN(MEDIASUBTYPE_SVQ1),
        KNOWN(MEDIASUBTYPE_H263),
        KNOWN(MEDIASUBTYPE_h263),
        KNOWN(MEDIASUBTYPE_S263),
        KNOWN(MEDIASUBTYPE_s263),
        KNOWN(MEDIASUBTYPE_AMVV),
        KNOWN(MEDIASUBTYPE_WVC1_CYBERLINK),
        KNOWN(MEDIASUBTYPE_WVC1_ARCSOFT),
        KNOWN(MEDIASUBTYPE_DVX3),
        KNOWN(MEDIASUBTYPE_dvx3),
        KNOWN(MEDIASUBTYPE_DIV3),
        KNOWN(MEDIASUBTYPE_div3),
        KNOWN(MEDIASUBTYPE_COL1),
        KNOWN(MEDIASUBTYPE_col1),
        KNOWN(MEDIASUBTYPE_DIV4),
        KNOWN(MEDIASUBTYPE_div4),
        KNOWN(MEDIASUBTYPE_DIV5),
        KNOWN(MEDIASUBTYPE_div5),
        KNOWN(MEDIASUBTYPE_DIV6),
        KNOWN(MEDIASUBTYPE_div6),
        KNOWN(MEDIASUBTYPE_AP41),
        KNOWN(MEDIASUBTYPE_ap41),
        KNOWN(MEDIASUBTYPE_MPG3),
        KNOWN(MEDIASUBTYPE_mpg3),
        KNOWN(MEDIASUBTYPE_DIV2),
        KNOWN(MEDIASUBTYPE_div2),
        KNOWN(MEDIASUBTYPE_DIV1),
        KNOWN(MEDIASUBTYPE_div1),
        KNOWN(MEDIASUBTYPE_MP41),
        KNOWN(MEDIASUBTYPE_mp41),
        KNOWN(MEDIASUBTYPE_THEORA),
        KNOWN(MEDIASUBTYPE_theora),
        KNOWN(FORMAT_RLTheora),
        KNOWN(MEDIASUBTYPE_IMA_AMV),
        KNOWN(MEDIASUBTYPE_NELLYMOSER),
        KNOWN(MEDIASUBTYPE_HDMV_LPCM_AUDIO),
        KNOWN(MEDIASUBTYPE_MLP),
        KNOWN(MEDIASUBTYPE_FFMPEG_AUDIO),
        KNOWN(FORMAT_WaveFormatExFFMPEG),
        KNOWN(DXVA_Intel_VC1_ClearVideo),
        KNOWN(DXVA_Intel_H264_ClearVideo),
        KNOWN(DXVA_MPEG4_ASP),
        KNOWN(MEDIASUBTYPE_422P),
        KNOWN(MEDIASUBTYPE_444P),
        KNOWN(MEDIASUBTYPE_411P),
        KNOWN(MEDIASUBTYPE_410P),
        KNOWN(MEDIASUBTYPE_VYUY),
        KNOWN(MEDIASUBTYPE_Y800),
        KNOWN(MEDIASUBTYPE_NV21),
        KNOWN(MEDIASUBTYPE_YV16),
        KNOWN(MEDIASUBTYPE_WavpackHybrid),
        KNOWN(MEDIASUBTYPE_VOBSUB2),
        KNOWN(MEDIASUBTYPE_DXRSub),
        KNOWN(MEDIASUBTYPE_EAC3),

        KNOWN(MEDIASUBTYPE_FLAC_XIPH),
        KNOWN(MEDIASUBTYPE_OggFLAC_1_0),
        KNOWN(FORMAT_FLAC),
        KNOWN(MEDIATYPE_OggPacketStream),
        KNOWN(FORMAT_OggIdentHeader),
        KNOWN(MEDIASUBTYPE_Ogg_XIPH),
        KNOWN(MEDIASUBTYPE_Speex),
        KNOWN(FORMAT_Speex),
        KNOWN(MEDIASUBTYPE_Theora),
        KNOWN(FORMAT_Theora),
        KNOWN(MEDIASUBTYPE_Vorbis_XIPH),
        KNOWN(FORMAT_Vorbis),
        KNOWN(FORMAT_Vorbis2),
        KNOWN(MEDIASUBTYPE_Schroedinger),
        KNOWN(FORMAT_Schroedinger),
        KNOWN(FORMAT_CMML),
        KNOWN(MEDIASUBTYPE_CMML),
        KNOWN(MEDIASUBTYPE_RawOggAudio),
        KNOWN(FORMAT_RawOggAudio),
        KNOWN(MEDIASUBTYPE_Dirac_XIPH),
        KNOWN(FORMAT_Dirac),

        KNOWN(KSDATAFORMAT_TYPE_BDA_ANTENNA),
        KNOWN(KSDATAFORMAT_SUBTYPE_BDA_MPEG2_TRANSPORT),
        KNOWN(KSDATAFORMAT_SPECIFIER_BDA_TRANSPORT),
        KNOWN(KSDATAFORMAT_TYPE_BDA_IF_SIGNAL),
        KNOWN(KSDATAFORMAT_TYPE_MPEG2_SECTIONS),
        KNOWN(KSDATAFORMAT_SUBTYPE_ATSC_SI),
        KNOWN(KSDATAFORMAT_SUBTYPE_DVB_SI),
        KNOWN(KSDATAFORMAT_SUBTYPE_BDA_OPENCABLE_PSIP),
        KNOWN(KSDATAFORMAT_SUBTYPE_BDA_OPENCABLE_OOB_PSIP),
        KNOWN(KSDATAFORMAT_SUBTYPE_ISDB_SI),
        KNOWN(KSDATAFORMAT_SUBTYPE_PBDA_TRANSPORT_RAW),
        KNOWN(KSDATAFORMAT_TYPE_BDA_IP),
        KNOWN(KSDATAFORMAT_SUBTYPE_BDA_IP),
        KNOWN(KSDATAFORMAT_SPECIFIER_BDA_IP),
        KNOWN(KSDATAFORMAT_TYPE_BDA_IP_CONTROL),
        KNOWN(KSDATAFORMAT_SUBTYPE_BDA_IP_CONTROL),
        KNOWN(KSDATAFORMAT_TYPE_MPE),

        // from 
        KNOWN(KSDATAFORMAT_SPECIFIER_DV_AVC),
        KNOWN(KSDATAFORMAT_SPECIFIER_AVC),
        KNOWN(KSDATAFORMAT_SPECIFIER_61883_4),

        // dxva.h
        KNOWN(DXVA_ModeNone),  
        KNOWN(DXVA_ModeH261_A),
        KNOWN(DXVA_ModeH261_B),
        KNOWN(DXVA_ModeH263_A),
        KNOWN(DXVA_ModeH263_B),
        KNOWN(DXVA_ModeH263_C),
        KNOWN(DXVA_ModeH263_D),
        KNOWN(DXVA_ModeH263_E),
        KNOWN(DXVA_ModeH263_F),
        KNOWN(DXVA_ModeMPEG1_A),
        KNOWN(DXVA_ModeMPEG2_A),
        KNOWN(DXVA_ModeMPEG2_B),
        KNOWN(DXVA_ModeMPEG2_C),
        KNOWN(DXVA_ModeMPEG2_D),
        KNOWN(DXVA_ModeH264_A),
        KNOWN(DXVA_ModeH264_B),
        KNOWN(DXVA_ModeH264_C),
        KNOWN(DXVA_ModeH264_D),
        KNOWN(DXVA_ModeH264_E),
        KNOWN(DXVA_ModeH264_F),
        KNOWN(DXVA_ModeWMV8_A),
        KNOWN(DXVA_ModeWMV8_B),
        KNOWN(DXVA_ModeWMV9_A),
        KNOWN(DXVA_ModeWMV9_B),
        KNOWN(DXVA_ModeWMV9_C),
        KNOWN(DXVA_ModeVC1_A), 
        KNOWN(DXVA_ModeVC1_B), 
        KNOWN(DXVA_ModeVC1_C), 
        KNOWN(DXVA_ModeVC1_D), 
        KNOWN(DXVA_NoEncrypt), 

        // dxva2api.h
        KNOWN(DXVA2_ModeMPEG2_MoComp),
        KNOWN(DXVA2_ModeMPEG2_IDCT),  
        KNOWN(DXVA2_ModeMPEG2_VLD),   
        KNOWN(DXVA2_ModeH264_A),
        KNOWN(DXVA2_ModeH264_B),
        KNOWN(DXVA2_ModeH264_C),
        KNOWN(DXVA2_ModeH264_D),
        KNOWN(DXVA2_ModeH264_E),
        KNOWN(DXVA2_ModeH264_F),
        KNOWN(DXVA2_ModeWMV8_A),
        KNOWN(DXVA2_ModeWMV8_B),
        KNOWN(DXVA2_ModeWMV9_A),
        KNOWN(DXVA2_ModeWMV9_B),
        KNOWN(DXVA2_ModeWMV9_C),
        KNOWN(DXVA2_ModeVC1_A), 
        KNOWN(DXVA2_ModeVC1_B), 
        KNOWN(DXVA2_ModeVC1_C), 
        KNOWN(DXVA2_ModeVC1_D), 
        KNOWN(DXVA2_NoEncrypt), 
        KNOWN(DXVA2_VideoProcProgressiveDevice),
        KNOWN(DXVA2_VideoProcBobDevice),        
        KNOWN(DXVA2_VideoProcSoftwareDevice),   

        KNOWN(MEDIASUBTYPE_DVB_SUBTITLES),
        KNOWN(MEDIASUBTYPE_ISDB_CAPTIONS),
        KNOWN(MEDIASUBTYPE_ISDB_SUPERIMPOSE),
        
	};
	const int KnownGuidCount = sizeof(KnownGuidList) / sizeof(KnownGuidList[0]);


	bool NameGuid(GUID guid, CString &str, bool alsoAddGuid)
	{
        bool found = false;

        for (int i=0; i<KnownGuidCount; i++) {			// lookup known GUIDS
			if (KnownGuidList[i].guid == guid) {
				str = CString(KnownGuidList[i].name);
                if(!alsoAddGuid) 
					return true;
				found = true;
                break;
			}
		}

		if (!found) {								// interpret as fourcc GUID
			const FOURCCMap fourccZeroed;
			GUID guidZeroed = guid;
			guidZeroed.Data1 = 0x0;
			CString fourccString;
			if (fourccZeroed == guidZeroed && 0==GetFourCC(guid.Data1, fourccString)) {
				str = _T("MEDIASUBTYPE_");
				str += fourccString;

				if(!alsoAddGuid) 
					return true;
				found = true;
			}
		}

        if(found)
            str.Append(_T(" "));

		LPOLESTR	str2;
		StringFromCLSID(guid, &str2);
        if(found)
            str.Append(CString(str2));
        else
            str = CString(str2);
		CoTaskMemFree(str2);

		return found;
	}

    bool InsertGuidLookup(int i, CListCtrl* pListCtrl)
    {
        if(i<0) return false;

        if(i<KnownGuidCount)
        {
            int nIndex = pListCtrl->InsertItem(pListCtrl->GetItemCount(), KnownGuidList[i].name);
            if(nIndex == -1) return false;

            CString		clsid_str;
		    CLSIDToString(KnownGuidList[i].guid, clsid_str);
            pListCtrl->SetItemText(nIndex, 1, clsid_str);
            pListCtrl->SetItemText(nIndex, 2, _T(""));
            pListCtrl->SetItemText(nIndex, 3, _T(""));

            CStringArray* arrData = new CStringArray();
            arrData->Add(KnownGuidList[i].name);
            arrData->Add(clsid_str);
            arrData->Add(_T(""));
            arrData->Add(_T(""));
            pListCtrl->SetItemData(nIndex, (DWORD_PTR)arrData);

            return true;
        }

        return CInterfaceScanner::InsertInterfaceLookup(i-KnownGuidCount, pListCtrl);
    }


	struct FormatTagPair {
		int		tag;
		LPCTSTR	name;
	};

	const FormatTagPair	KnownFormatsList[] = 
	{
		{ 0,		_T("Invalid Format") },
		{ 1,		_T("Raw PCM") },
		{ 2,		_T("ADPCM") },
		{ 3,		_T("IEEE Float") },
		{ 5,		_T("IBM CVSD") },
		{ 6,		_T("A-Law PCM") },
		{ 7,		_T("Mu-Law PCM") },
		{ 0x10,		_T("OKI ADPCM") },
		{ 0x11,		_T("DVI/IMA ADPCM") },
		{ 0x12,		_T("Mediaspace ADPCM") },
		{ 0x13,		_T("Sierra ADPCM") },
		{ 0x14,		_T("G.723 ADPCM") },
		{ 0x15,		_T("DigiSTD") },
		{ 0x16,		_T("DigiFIX") },
		{ 0x17,		_T("Dialogic OKI ADPCM") },
		{ 0x18,		_T("Media Vision ADPCM") },
		{ 0x20,		_T("YAMAHA ADPCM") },
		{ 0x21,		_T("Sonarc Speech") },
		{ 0x22,		_T("DSP Group TrueSpeech") },
		{ 0x23,		_T("Echo Speech") },
		{ 0x24,		_T("AudioFile AF36") },
		{ 0x25,		_T("APTX") },
		{ 0x26,		_T("AudioFile AF10") },
		{ 0x30,		_T("Dolby AC-2") },
		{ 0x31,		_T("GSM 6.10") },
		{ 0x32,		_T("MSN Audio") },
		{ 0x33,		_T("Antex ADPCME") },
		{ 0x34,		_T("Control Resources VQLPC") },
		{ 0x35,		_T("DigiReal") },
		{ 0x36,		_T("DigiADPCM") },
		{ 0x37,		_T("Control Resources CR10") },
		{ 0x38,		_T("NMS VBXADPCM") },
		{ 0x39,		_T("CS IMA ADPCM") },
		{ 0x3A,		_T("Echo Speech 3") },
		{ 0x3B,		_T("Rockwell ADPCM") },
		{ 0x3C,		_T("Rockwell Digitalk") },
		{ 0x3D,		_T("Xebec") },
		{ 0x40,		_T("G.721 ADPCM") },
		{ 0x41,		_T("G.728 CELP") },
		{ 0x50,		_T("MPEG Audio") },
		{ 0x55,		_T("MPEG Layer 3") },
		{ 0x60,		_T("Cirrus Logic") },
		{ 0x61,		_T("ESS PCM") },
		{ 0x62,		_T("Voxware") },
		{ 0x63,		_T("Canopus ATRAC") },
		{ 0x64,		_T("G.726 ADPCM") },
		{ 0x65,		_T("G.722 ADPCM") },
		{ 0x66,		_T("DSAT") },
		{ 0x67,		_T("DSAT Display") },
		{ 0x80,		_T("Softsound") },
		{ 0xFF,		_T("MPEG-2/4 AAC") },
		{ 0x100,	_T("Rhetorex ADPCM") },
		{ 0x200,	_T("Creative ADPCM") },
		{ 0x202,	_T("Creative Fastspeech 8") },
		{ 0x203,	_T("Creative Fastspeech 10") },
		{ 0x300,	_T("Quarterdeck") },
		{ 0x400,	_T("Brooktree Digital") },
		{ 0x1000,	_T("Olivetti GSM") },
		{ 0x1001,	_T("Olivetti ADPCM") },
		{ 0x1002,	_T("Olivetti CELP") },
		{ 0x1003,	_T("Olivetti SBC") },
		{ 0x1004,	_T("Olivetti OPR") },
		{ 0x1100,	_T("LH Codec") },
		{ 0x1400,	_T("Norris") },
		{ 0x2000,	_T("Dolby AC-3") }
	};
	const int KnownFormatsCount = sizeof(KnownFormatsList) / sizeof(KnownFormatsList[0]);

	int GetFormatName(int wFormatTag, CString &str)
	{
		for (int i=0; i<KnownFormatsCount; i++) {
			if (wFormatTag == KnownFormatsList[i].tag) {
				str = CString(KnownFormatsList[i].name);
				return 0;
			}
		}

		str.Format(_T("Unknown (%d)"), wFormatTag);
		return 1;
	}







    #define	KNOWNHR(x)			{ x, _T( # x ) }
	struct HResultPair {
		HRESULT hr; 
		LPCTSTR	name;
	};

	const HResultPair	KnownHResultList[] = 
    {
        // WinError.h
        KNOWNHR(S_OK),
        KNOWNHR(S_FALSE),
        KNOWNHR(E_NOT_SET),
        KNOWNHR(E_NOT_VALID_STATE),
        KNOWNHR(E_NOT_SUFFICIENT_BUFFER),
        KNOWNHR(E_UNEXPECTED),
        KNOWNHR(E_NOTIMPL),
        KNOWNHR(E_OUTOFMEMORY),
        KNOWNHR(E_INVALIDARG),
        KNOWNHR(E_NOINTERFACE),
        KNOWNHR(E_POINTER),
        KNOWNHR(E_HANDLE),
        KNOWNHR(E_ABORT),
        KNOWNHR(E_FAIL),
        KNOWNHR(E_ACCESSDENIED),
        KNOWNHR(E_PENDING),
        KNOWNHR(CLASS_E_NOAGGREGATION),
        KNOWNHR(CLASS_E_CLASSNOTAVAILABLE),
        KNOWNHR(CLASS_E_NOTLICENSED),
        KNOWNHR(REGDB_E_READREGDB),
        KNOWNHR(REGDB_E_WRITEREGDB),
        KNOWNHR(REGDB_E_KEYMISSING),
        KNOWNHR(REGDB_E_INVALIDVALUE),
        KNOWNHR(REGDB_E_CLASSNOTREG),
        KNOWNHR(REGDB_E_IIDNOTREG),
        KNOWNHR(REGDB_E_BADTHREADINGMODEL),
        
        // Vfwmsgs.h
        KNOWNHR(VFW_E_INVALIDMEDIATYPE),
        KNOWNHR(VFW_E_INVALIDSUBTYPE),
        KNOWNHR(VFW_E_NEED_OWNER),
        KNOWNHR(VFW_E_ENUM_OUT_OF_SYNC),
        KNOWNHR(VFW_E_ALREADY_CONNECTED),
        KNOWNHR(VFW_E_FILTER_ACTIVE),
        KNOWNHR(VFW_E_NO_TYPES),
        KNOWNHR(VFW_E_NO_ACCEPTABLE_TYPES),
        KNOWNHR(VFW_E_INVALID_DIRECTION),
        KNOWNHR(VFW_E_NOT_CONNECTED),
        KNOWNHR(VFW_E_NO_ALLOCATOR),
        KNOWNHR(VFW_E_RUNTIME_ERROR),
        KNOWNHR(VFW_E_BUFFER_NOTSET),
        KNOWNHR(VFW_E_BUFFER_OVERFLOW),
        KNOWNHR(VFW_E_BADALIGN),
        KNOWNHR(VFW_E_ALREADY_COMMITTED),
        KNOWNHR(VFW_E_BUFFERS_OUTSTANDING),
        KNOWNHR(VFW_E_NOT_COMMITTED),
        KNOWNHR(VFW_E_SIZENOTSET),
        KNOWNHR(VFW_E_NO_CLOCK),
        KNOWNHR(VFW_E_NO_SINK),
        KNOWNHR(VFW_E_NO_INTERFACE),
        KNOWNHR(VFW_E_NOT_FOUND),
        KNOWNHR(VFW_E_CANNOT_CONNECT),
        KNOWNHR(VFW_E_CANNOT_RENDER),
        KNOWNHR(VFW_E_CHANGING_FORMAT),
        KNOWNHR(VFW_E_NO_COLOR_KEY_SET),
        KNOWNHR(VFW_E_NOT_OVERLAY_CONNECTION),
        KNOWNHR(VFW_E_NOT_SAMPLE_CONNECTION),
        KNOWNHR(VFW_E_PALETTE_SET),
        KNOWNHR(VFW_E_COLOR_KEY_SET),
        KNOWNHR(VFW_E_NO_COLOR_KEY_FOUND),
        KNOWNHR(VFW_E_NO_PALETTE_AVAILABLE),
        KNOWNHR(VFW_E_NO_DISPLAY_PALETTE),
        KNOWNHR(VFW_E_TOO_MANY_COLORS),
        KNOWNHR(VFW_E_STATE_CHANGED),
        KNOWNHR(VFW_E_NOT_STOPPED),
        KNOWNHR(VFW_E_NOT_PAUSED),
        KNOWNHR(VFW_E_NOT_RUNNING),
        KNOWNHR(VFW_E_WRONG_STATE),
        KNOWNHR(VFW_E_START_TIME_AFTER_END),
        KNOWNHR(VFW_E_INVALID_RECT),
        KNOWNHR(VFW_E_TYPE_NOT_ACCEPTED),
        KNOWNHR(VFW_E_SAMPLE_REJECTED),
        KNOWNHR(VFW_E_SAMPLE_REJECTED_EOS),
        KNOWNHR(VFW_E_DUPLICATE_NAME),
        KNOWNHR(VFW_E_TIMEOUT),
        KNOWNHR(VFW_E_INVALID_FILE_FORMAT),
        KNOWNHR(VFW_E_ENUM_OUT_OF_RANGE),
        KNOWNHR(VFW_E_CIRCULAR_GRAPH),
        KNOWNHR(VFW_E_NOT_ALLOWED_TO_SAVE),
        KNOWNHR(VFW_E_TIME_ALREADY_PASSED),
        KNOWNHR(VFW_E_ALREADY_CANCELLED),
        KNOWNHR(VFW_E_CORRUPT_GRAPH_FILE),
        KNOWNHR(VFW_E_ADVISE_ALREADY_SET),
        KNOWNHR(VFW_S_STATE_INTERMEDIATE),
        KNOWNHR(VFW_E_NO_MODEX_AVAILABLE),
        KNOWNHR(VFW_E_NO_ADVISE_SET),
        KNOWNHR(VFW_E_NO_FULLSCREEN),
        KNOWNHR(VFW_E_IN_FULLSCREEN_MODE),
        KNOWNHR(VFW_E_UNKNOWN_FILE_TYPE),
        KNOWNHR(VFW_E_CANNOT_LOAD_SOURCE_FILTER),
        KNOWNHR(VFW_S_PARTIAL_RENDER),
        KNOWNHR(VFW_E_FILE_TOO_SHORT),
        KNOWNHR(VFW_E_INVALID_FILE_VERSION),
        KNOWNHR(VFW_S_SOME_DATA_IGNORED),
        KNOWNHR(VFW_S_CONNECTIONS_DEFERRED),
        KNOWNHR(VFW_E_INVALID_CLSID),
        KNOWNHR(VFW_E_INVALID_MEDIA_TYPE),
        KNOWNHR(VFW_E_BAD_KEY),
        KNOWNHR(VFW_S_NO_MORE_ITEMS),
        KNOWNHR(VFW_E_SAMPLE_TIME_NOT_SET),
        KNOWNHR(VFW_S_RESOURCE_NOT_NEEDED),
        KNOWNHR(VFW_E_MEDIA_TIME_NOT_SET),
        KNOWNHR(VFW_E_NO_TIME_FORMAT_SET),
        KNOWNHR(VFW_E_MONO_AUDIO_HW),
        KNOWNHR(VFW_S_MEDIA_TYPE_IGNORED),
        KNOWNHR(VFW_E_NO_DECOMPRESSOR),
        KNOWNHR(VFW_E_NO_AUDIO_HARDWARE),
        KNOWNHR(VFW_S_VIDEO_NOT_RENDERED),
        KNOWNHR(VFW_S_AUDIO_NOT_RENDERED),
        KNOWNHR(VFW_E_RPZA),
        KNOWNHR(VFW_S_RPZA),
        KNOWNHR(VFW_E_PROCESSOR_NOT_SUITABLE),
        KNOWNHR(VFW_E_UNSUPPORTED_AUDIO),
        KNOWNHR(VFW_E_UNSUPPORTED_VIDEO),
        KNOWNHR(VFW_E_MPEG_NOT_CONSTRAINED),
        KNOWNHR(VFW_E_NOT_IN_GRAPH),
        KNOWNHR(VFW_S_ESTIMATED),
        KNOWNHR(VFW_E_NO_TIME_FORMAT),
        KNOWNHR(VFW_E_READ_ONLY),
        KNOWNHR(VFW_S_RESERVED),
        KNOWNHR(VFW_E_BUFFER_UNDERFLOW),
        KNOWNHR(VFW_E_UNSUPPORTED_STREAM),
        KNOWNHR(VFW_E_NO_TRANSPORT),
        KNOWNHR(VFW_S_STREAM_OFF),
        KNOWNHR(VFW_S_CANT_CUE),
        KNOWNHR(VFW_E_BAD_VIDEOCD),
        KNOWNHR(VFW_S_NO_STOP_TIME),
        KNOWNHR(VFW_E_OUT_OF_VIDEO_MEMORY),
        KNOWNHR(VFW_E_VP_NEGOTIATION_FAILED),
        KNOWNHR(VFW_E_DDRAW_CAPS_NOT_SUITABLE),
        KNOWNHR(VFW_E_NO_VP_HARDWARE),
        KNOWNHR(VFW_E_NO_CAPTURE_HARDWARE),
        KNOWNHR(VFW_E_DVD_OPERATION_INHIBITED),
        KNOWNHR(VFW_E_DVD_INVALIDDOMAIN),
        KNOWNHR(VFW_E_DVD_NO_BUTTON),
        KNOWNHR(VFW_E_DVD_GRAPHNOTREADY),
        KNOWNHR(VFW_E_DVD_RENDERFAIL),
        KNOWNHR(VFW_E_DVD_DECNOTENOUGH),
        KNOWNHR(VFW_E_DDRAW_VERSION_NOT_SUITABLE),
        KNOWNHR(VFW_E_COPYPROT_FAILED),
        KNOWNHR(VFW_S_NOPREVIEWPIN),
        KNOWNHR(VFW_E_TIME_EXPIRED),
        KNOWNHR(VFW_S_DVD_NON_ONE_SEQUENTIAL),
        KNOWNHR(VFW_E_DVD_WRONG_SPEED),
        KNOWNHR(VFW_E_DVD_MENU_DOES_NOT_EXIST),
        KNOWNHR(VFW_E_DVD_CMD_CANCELLED),
        KNOWNHR(VFW_E_DVD_STATE_WRONG_VERSION),
        KNOWNHR(VFW_E_DVD_STATE_CORRUPT),
        KNOWNHR(VFW_E_DVD_STATE_WRONG_DISC),
        KNOWNHR(VFW_E_DVD_INCOMPATIBLE_REGION),
        KNOWNHR(VFW_E_DVD_NO_ATTRIBUTES),
        KNOWNHR(VFW_E_DVD_NO_GOUP_PGC),
        KNOWNHR(VFW_E_DVD_LOW_PARENTAL_LEVEL),
        KNOWNHR(VFW_E_DVD_NOT_IN_KARAOKE_MODE),
        KNOWNHR(VFW_S_DVD_CHANNEL_CONTENTS_NOT_AVAILABLE),
        KNOWNHR(VFW_S_DVD_NOT_ACCURATE),
        KNOWNHR(VFW_E_FRAME_STEP_UNSUPPORTED),
        KNOWNHR(VFW_E_DVD_STREAM_DISABLED),
        KNOWNHR(VFW_E_DVD_TITLE_UNKNOWN),
        KNOWNHR(VFW_E_DVD_INVALID_DISC),
        KNOWNHR(VFW_E_DVD_NO_RESUME_INFORMATION),
        KNOWNHR(VFW_E_PIN_ALREADY_BLOCKED_ON_THIS_THREAD),
        KNOWNHR(VFW_E_PIN_ALREADY_BLOCKED),
        KNOWNHR(VFW_E_CERTIFICATION_FAILURE),
        KNOWNHR(VFW_E_VMR_NOT_IN_MIXER_MODE),
        KNOWNHR(VFW_E_VMR_NO_AP_SUPPLIED),
        KNOWNHR(VFW_E_VMR_NO_DEINTERLACE_HW),
        KNOWNHR(VFW_E_VMR_NO_PROCAMP_HW),
        KNOWNHR(VFW_E_DVD_VMR9_INCOMPATIBLEDEC),
        KNOWNHR(VFW_E_VMR_NO_AP_SUPPLIED),
        KNOWNHR(VFW_E_VMR_NO_DEINTERLACE_HW),
        KNOWNHR(VFW_E_VMR_NO_PROCAMP_HW),
        KNOWNHR(VFW_E_DVD_VMR9_INCOMPATIBLEDEC),
        KNOWNHR(VFW_E_NO_COPP_HW),
        KNOWNHR(VFW_E_DVD_NONBLOCKING),
        KNOWNHR(VFW_E_DVD_TOO_MANY_RENDERERS_IN_FILTER_GRAPH),
        KNOWNHR(VFW_E_DVD_NON_EVR_RENDERER_IN_FILTER_GRAPH),
        KNOWNHR(VFW_E_DVD_RESOLUTION_ERROR),
        KNOWNHR(E_PROP_SET_UNSUPPORTED),
        KNOWNHR(E_PROP_ID_UNSUPPORTED),
        KNOWNHR(VFW_E_CODECAPI_LINEAR_RANGE),
        KNOWNHR(VFW_E_CODECAPI_ENUMERATED),
        KNOWNHR(VFW_E_CODECAPI_NO_DEFAULT),
        KNOWNHR(VFW_E_CODECAPI_NO_CURRENT_VALUE),
        KNOWNHR(VFW_E_DVD_CHAPTER_DOES_NOT_EXIST),

        // asferr.h
        KNOWNHR(ASF_E_ALREADYINITIALIZED),
        KNOWNHR(ASF_E_BADDATADESCRIPTOR),
        KNOWNHR(ASF_E_BADDATAUNIT),
        KNOWNHR(ASF_E_BADINDEXINTERVAL),
        KNOWNHR(ASF_E_BADLANGUAGEID),	
        KNOWNHR(ASF_E_BADMEDIATYPE),	
        KNOWNHR(ASF_E_BUFFEROVERRUN),	
        KNOWNHR(ASF_E_BUFFERTOOSMALL),
        KNOWNHR(ASF_E_EXCEEDEDMAXIMUMOBJECTSIZE),
        KNOWNHR(ASF_E_HEADERSIZE),
        KNOWNHR(ASF_E_INDEXBLOCKUNLOADED),
        KNOWNHR(ASF_E_INVALIDFLAGS),	
        KNOWNHR(ASF_E_INVALIDHEADER),	
        KNOWNHR(ASF_E_INVALIDINDEX),	
        KNOWNHR(ASF_E_INVALIDINIT),	
        KNOWNHR(ASF_E_INVALIDSTATE),	
        KNOWNHR(ASF_E_INVALIDTIME),	
        KNOWNHR(ASF_E_NOCLOCKOBJECT),	
        KNOWNHR(ASF_E_NODATAOBJECT),	
        KNOWNHR(ASF_E_NOFILEPROPS),	
        KNOWNHR(ASF_E_NOHEADEROBJECT),
        KNOWNHR(ASF_E_NOINDEXOBJECT),
        KNOWNHR(ASF_E_NOLIBRARY),
        KNOWNHR(ASF_E_NOPAYLOADLENGTH),
        KNOWNHR(ASF_E_NOSTREAMPROPS),
        KNOWNHR(ASF_E_NOTENOUGHBANDWIDTH),
        KNOWNHR(ASF_E_NOTENOUGHDESCRIPTORS),
        KNOWNHR(ASF_E_NOTFOUND),
        KNOWNHR(ASF_E_OBJECTTOOBIG),
        KNOWNHR(ASF_E_OPAQUEPACKET),
        KNOWNHR(ASF_E_OVERFLOW),
        KNOWNHR(ASF_E_PACKETCONTENTTOOLARGE),
        KNOWNHR(ASF_E_STREAMNUMBERINUSE),
        KNOWNHR(ASF_E_TOOMANYPAYLOADS),
        KNOWNHR(ASF_E_UNEXPECTEDVALUE),
        KNOWNHR(ASF_E_UNKNOWNCLOCKTYPE),
        KNOWNHR(ASF_E_UNKNOWNPACKETSIZE),
        KNOWNHR(ASF_E_WRITEFAILED),
        KNOWNHR(ASF_E_WRONGVERSION),

        // from nserror.h
        KNOWNHR(NS_E_DRM_INVALID_APPLICATION),
        KNOWNHR(NS_E_DRM_LICENSE_STORE_ERROR),
        KNOWNHR(NS_E_DRM_SECURE_STORE_ERROR),
        KNOWNHR(NS_E_DRM_LICENSE_STORE_SAVE_ERROR),
        KNOWNHR(NS_E_DRM_SECURE_STORE_UNLOCK_ERROR),
        KNOWNHR(NS_E_DRM_INVALID_CONTENT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_OPEN_LICENSE),
        KNOWNHR(NS_E_DRM_INVALID_LICENSE),
        KNOWNHR(NS_E_DRM_INVALID_MACHINE),
        KNOWNHR(NS_E_DRM_ENUM_LICENSE_FAILED),
        KNOWNHR(NS_E_DRM_INVALID_LICENSE_REQUEST),
        KNOWNHR(NS_E_DRM_UNABLE_TO_INITIALIZE),
        KNOWNHR(NS_E_DRM_UNABLE_TO_ACQUIRE_LICENSE),
        KNOWNHR(NS_E_DRM_INVALID_LICENSE_ACQUIRED),
        KNOWNHR(NS_E_DRM_NO_RIGHTS),
        KNOWNHR(NS_E_DRM_KEY_ERROR),
        KNOWNHR(NS_E_DRM_ENCRYPT_ERROR),
        KNOWNHR(NS_E_DRM_DECRYPT_ERROR),
        KNOWNHR(NS_E_DRM_LICENSE_INVALID_XML),
        KNOWNHR(NS_S_DRM_LICENSE_ACQUIRED),
        KNOWNHR(NS_S_DRM_INDIVIDUALIZED),
        KNOWNHR(NS_E_DRM_NEEDS_INDIVIDUALIZATION),
        KNOWNHR(NS_E_DRM_ALREADY_INDIVIDUALIZED),
        KNOWNHR(NS_E_DRM_ACTION_NOT_QUERIED),
        KNOWNHR(NS_E_DRM_ACQUIRING_LICENSE),
        KNOWNHR(NS_E_DRM_INDIVIDUALIZING),
        KNOWNHR(NS_E_BACKUP_RESTORE_FAILURE),
        KNOWNHR(NS_E_BACKUP_RESTORE_BAD_REQUEST_ID),
        KNOWNHR(NS_E_DRM_PARAMETERS_MISMATCHED),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_LICENSE_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_INDI_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_ENCRYPT_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_DECRYPT_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_PROPERTIES_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_BACKUP_OBJECT),
        KNOWNHR(NS_E_DRM_INDIVIDUALIZE_ERROR),
        KNOWNHR(NS_E_DRM_LICENSE_OPEN_ERROR),
        KNOWNHR(NS_E_DRM_LICENSE_CLOSE_ERROR),
        KNOWNHR(NS_E_DRM_GET_LICENSE_ERROR),
        KNOWNHR(NS_E_DRM_QUERY_ERROR),
        KNOWNHR(NS_E_DRM_REPORT_ERROR),
        KNOWNHR(NS_E_DRM_GET_LICENSESTRING_ERROR),
        KNOWNHR(NS_E_DRM_GET_CONTENTSTRING_ERROR),
        KNOWNHR(NS_E_DRM_MONITOR_ERROR),
        KNOWNHR(NS_E_DRM_UNABLE_TO_SET_PARAMETER),
        KNOWNHR(NS_E_DRM_INVALID_APPDATA),
        KNOWNHR(NS_E_DRM_INVALID_APPDATA_VERSION),
        KNOWNHR(NS_E_DRM_BACKUP_EXISTS),
        KNOWNHR(NS_E_DRM_BACKUP_CORRUPT),
        KNOWNHR(NS_E_DRM_BACKUPRESTORE_BUSY),
        KNOWNHR(NS_E_BACKUP_RESTORE_BAD_DATA),
        KNOWNHR(NS_S_DRM_MONITOR_CANCELLED),
        KNOWNHR(NS_S_DRM_ACQUIRE_CANCELLED),
        KNOWNHR(NS_E_DRM_LICENSE_UNUSABLE),
        KNOWNHR(NS_E_DRM_INVALID_PROPERTY),
        KNOWNHR(NS_E_DRM_SECURE_STORE_NOT_FOUND),
        KNOWNHR(NS_E_DRM_CACHED_CONTENT_ERROR),
        KNOWNHR(NS_E_DRM_INDIVIDUALIZATION_INCOMPLETE),
        KNOWNHR(NS_E_DRM_DRIVER_AUTH_FAILURE),
        KNOWNHR(NS_E_DRM_NEED_UPGRADE_MSSAP),
        KNOWNHR(NS_E_DRM_REOPEN_CONTENT),
        KNOWNHR(NS_E_DRM_DRIVER_DIGIOUT_FAILURE),
        KNOWNHR(NS_E_DRM_INVALID_SECURESTORE_PASSWORD),
        KNOWNHR(NS_E_DRM_APPCERT_REVOKED),
        KNOWNHR(NS_E_DRM_RESTORE_FRAUD),
        KNOWNHR(NS_E_DRM_HARDWARE_INCONSISTENT),
        KNOWNHR(NS_E_DRM_SDMI_TRIGGER),
        KNOWNHR(NS_E_DRM_SDMI_NOMORECOPIES),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_HEADER_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_KEYS_OBJECT),
        KNOWNHR(NS_E_DRM_LICENSE_NOTACQUIRED),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_CODING_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_STATE_DATA_OBJECT),
        KNOWNHR(NS_E_DRM_BUFFER_TOO_SMALL),
        KNOWNHR(NS_E_DRM_UNSUPPORTED_PROPERTY),
        KNOWNHR(NS_E_DRM_ERROR_BAD_NET_RESP),
        KNOWNHR(NS_E_DRM_STORE_NOTALLSTORED),
        KNOWNHR(NS_E_DRM_SECURITY_COMPONENT_SIGNATURE_INVALID),
        KNOWNHR(NS_E_DRM_INVALID_DATA),
        KNOWNHR(NS_E_DRM_POLICY_DISABLE_ONLINE),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_AUTHENTICATION_OBJECT),
        KNOWNHR(NS_E_DRM_NOT_CONFIGURED),
        KNOWNHR(NS_E_DRM_DEVICE_ACTIVATION_CANCELED),
        KNOWNHR(NS_E_BACKUP_RESTORE_TOO_MANY_RESETS),
        KNOWNHR(NS_E_DRM_DEBUGGING_NOT_ALLOWED),
        KNOWNHR(NS_E_DRM_OPERATION_CANCELED),
        KNOWNHR(NS_E_DRM_RESTRICTIONS_NOT_RETRIEVED),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_PLAYLIST_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_PLAYLIST_BURN_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_DEVICE_REGISTRATION_OBJECT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_METERING_OBJECT),
        KNOWNHR(NS_S_DRM_BURNABLE_TRACK),
        KNOWNHR(NS_S_DRM_BURNABLE_TRACK_WITH_PLAYLIST_RESTRICTION),
        KNOWNHR(NS_E_DRM_TRACK_EXCEEDED_PLAYLIST_RESTICTION),
        KNOWNHR(NS_E_DRM_TRACK_EXCEEDED_TRACKBURN_RESTRICTION),
        KNOWNHR(NS_E_DRM_UNABLE_TO_GET_DEVICE_CERT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_GET_SECURE_CLOCK),
        KNOWNHR(NS_E_DRM_UNABLE_TO_SET_SECURE_CLOCK),
        KNOWNHR(NS_E_DRM_UNABLE_TO_GET_SECURE_CLOCK_FROM_SERVER),
        KNOWNHR(NS_E_DRM_POLICY_METERING_DISABLED),
        KNOWNHR(NS_E_DRM_TRANSFER_CHAINED_LICENSES_UNSUPPORTED),
        KNOWNHR(NS_E_DRM_SDK_VERSIONMISMATCH),
        KNOWNHR(NS_E_DRM_LIC_NEEDS_DEVICE_CLOCK_SET),
        KNOWNHR(NS_E_LICENSE_HEADER_MISSING_URL),
        KNOWNHR(NS_E_DEVICE_NOT_WMDRM_DEVICE),
        KNOWNHR(NS_E_DRM_INVALID_APPCERT),
        KNOWNHR(NS_E_DRM_PROTOCOL_FORCEFUL_TERMINATION_ON_PETITION),
        KNOWNHR(NS_E_DRM_PROTOCOL_FORCEFUL_TERMINATION_ON_CHALLENGE),
        KNOWNHR(NS_E_DRM_CHECKPOINT_FAILED),
        KNOWNHR(NS_E_DRM_BB_UNABLE_TO_INITIALIZE),
        KNOWNHR(NS_E_DRM_UNABLE_TO_LOAD_HARDWARE_ID),
        KNOWNHR(NS_E_DRM_UNABLE_TO_OPEN_DATA_STORE),
        KNOWNHR(NS_E_DRM_DATASTORE_CORRUPT),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_INMEMORYSTORE_OBJECT),
        KNOWNHR(NS_E_DRM_STUBLIB_REQUIRED),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_CERTIFICATE_OBJECT),
        KNOWNHR(NS_E_DRM_MIGRATION_TARGET_NOT_ONLINE),
        KNOWNHR(NS_E_DRM_INVALID_MIGRATION_IMAGE),
        KNOWNHR(NS_E_DRM_MIGRATION_TARGET_STATES_CORRUPTED),
        KNOWNHR(NS_E_DRM_MIGRATION_IMPORTER_NOT_AVAILABLE),
        KNOWNHR(NS_DRM_E_MIGRATION_UPGRADE_WITH_DIFF_SID),
        KNOWNHR(NS_DRM_E_MIGRATION_SOURCE_MACHINE_IN_USE),
        KNOWNHR(NS_DRM_E_MIGRATION_TARGET_MACHINE_LESS_THAN_LH),
        KNOWNHR(NS_DRM_E_MIGRATION_IMAGE_ALREADY_EXISTS),
        KNOWNHR(NS_E_DRM_HARDWAREID_MISMATCH),
        KNOWNHR(NS_E_INVALID_DRMV2CLT_STUBLIB),
        KNOWNHR(NS_E_DRM_MIGRATION_INVALID_LEGACYV2_DATA),
        KNOWNHR(NS_E_DRM_MIGRATION_LICENSE_ALREADY_EXISTS),
        KNOWNHR(NS_E_DRM_MIGRATION_INVALID_LEGACYV2_SST_PASSWORD),
        KNOWNHR(NS_E_DRM_MIGRATION_NOT_SUPPORTED),
        KNOWNHR(NS_E_DRM_UNABLE_TO_CREATE_MIGRATION_IMPORTER_OBJECT),
        KNOWNHR(NS_E_DRM_CHECKPOINT_MISMATCH),
        KNOWNHR(NS_E_DRM_CHECKPOINT_CORRUPT),
        KNOWNHR(NS_E_REG_FLUSH_FAILURE),
        KNOWNHR(NS_E_HDS_KEY_MISMATCH),
        KNOWNHR(NS_E_DRM_MIGRATION_OPERATION_CANCELLED),
        KNOWNHR(NS_E_DRM_MIGRATION_OBJECT_IN_USE),
        KNOWNHR(NS_E_DRM_MALFORMED_CONTENT_HEADER),
        KNOWNHR(NS_E_DRM_LICENSE_EXPIRED),
        KNOWNHR(NS_E_DRM_LICENSE_NOTENABLED),
        KNOWNHR(NS_E_DRM_LICENSE_APPSECLOW),
        KNOWNHR(NS_E_DRM_STORE_NEEDINDI),
        KNOWNHR(NS_E_DRM_STORE_NOTALLOWED),
        KNOWNHR(NS_E_DRM_LICENSE_APP_NOTALLOWED),
        KNOWNHR(NS_S_DRM_NEEDS_INDIVIDUALIZATION),
        KNOWNHR(NS_E_DRM_LICENSE_CERT_EXPIRED),
        KNOWNHR(NS_E_DRM_LICENSE_SECLOW),
        KNOWNHR(NS_E_DRM_LICENSE_CONTENT_REVOKED),
        KNOWNHR(NS_E_DRM_DEVICE_NOT_REGISTERED),
        KNOWNHR(NS_E_DRM_LICENSE_NOSAP),
        KNOWNHR(NS_E_DRM_LICENSE_NOSVP),
        KNOWNHR(NS_E_DRM_LICENSE_NOWDM),
        KNOWNHR(NS_E_DRM_LICENSE_NOTRUSTEDCODEC),
        KNOWNHR(NS_E_DRM_SOURCEID_NOT_SUPPORTED),
        KNOWNHR(NS_E_DRM_NEEDS_UPGRADE_TEMPFILE),
        KNOWNHR(NS_E_DRM_NEED_UPGRADE_PD),
        KNOWNHR(NS_E_DRM_SIGNATURE_FAILURE),
        KNOWNHR(NS_E_DRM_LICENSE_SERVER_INFO_MISSING),
        KNOWNHR(NS_E_DRM_BUSY),
        KNOWNHR(NS_E_DRM_PD_TOO_MANY_DEVICES),
        KNOWNHR(NS_E_DRM_INDIV_FRAUD),
        KNOWNHR(NS_E_DRM_INDIV_NO_CABS),
        KNOWNHR(NS_E_DRM_INDIV_SERVICE_UNAVAILABLE),
        KNOWNHR(NS_E_DRM_RESTORE_SERVICE_UNAVAILABLE),
        KNOWNHR(NS_E_DRM_CLIENT_CODE_EXPIRED),
        KNOWNHR(NS_E_DRM_NO_UPLINK_LICENSE),
        KNOWNHR(NS_E_DRM_INVALID_KID),
        KNOWNHR(NS_E_DRM_LICENSE_INITIALIZATION_ERROR),
        KNOWNHR(NS_E_DRM_CHAIN_TOO_LONG),
        KNOWNHR(NS_E_DRM_UNSUPPORTED_ALGORITHM),
        KNOWNHR(NS_E_DRM_LICENSE_DELETION_ERROR),
        KNOWNHR(NS_E_DRM_INVALID_CERTIFICATE),
        KNOWNHR(NS_E_DRM_CERTIFICATE_REVOKED),
        KNOWNHR(NS_E_DRM_LICENSE_UNAVAILABLE),
        KNOWNHR(NS_E_DRM_DEVICE_LIMIT_REACHED),
        KNOWNHR(NS_E_DRM_UNABLE_TO_VERIFY_PROXIMITY),
        KNOWNHR(NS_E_DRM_MUST_REGISTER),
        KNOWNHR(NS_E_DRM_MUST_APPROVE),
        KNOWNHR(NS_E_DRM_MUST_REVALIDATE),
        KNOWNHR(NS_E_DRM_INVALID_PROXIMITY_RESPONSE),
        KNOWNHR(NS_E_DRM_INVALID_SESSION),
        KNOWNHR(NS_E_DRM_DEVICE_NOT_OPEN),
        KNOWNHR(NS_E_DRM_DEVICE_ALREADY_REGISTERED),
        KNOWNHR(NS_E_DRM_UNSUPPORTED_PROTOCOL_VERSION),
        KNOWNHR(NS_E_DRM_UNSUPPORTED_ACTION),
        KNOWNHR(NS_E_DRM_CERTIFICATE_SECURITY_LEVEL_INADEQUATE),
        KNOWNHR(NS_E_DRM_UNABLE_TO_OPEN_PORT),
        KNOWNHR(NS_E_DRM_BAD_REQUEST),
        KNOWNHR(NS_E_DRM_INVALID_CRL),
        KNOWNHR(NS_E_DRM_ATTRIBUTE_TOO_LONG),
        KNOWNHR(NS_E_DRM_EXPIRED_LICENSEBLOB),
        KNOWNHR(NS_E_DRM_INVALID_LICENSEBLOB),
        KNOWNHR(NS_E_DRM_INCLUSION_LIST_REQUIRED),
        KNOWNHR(NS_E_DRM_DRMV2CLT_REVOKED),
        KNOWNHR(NS_E_DRM_RIV_TOO_SMALL),
        KNOWNHR(NS_E_BUSY),
        KNOWNHR(NS_E_FILE_OPEN_FAILED),
        KNOWNHR(NS_E_FILE_WRITE),
        KNOWNHR(NS_E_INVALID_DATA),
        KNOWNHR(NS_E_INVALID_OUTPUT_FORMAT),
        KNOWNHR(NS_E_INVALID_REQUEST),
        KNOWNHR(NS_E_INVALIDPROFILE),
        KNOWNHR(NS_E_NO_MORE_SAMPLES),
        KNOWNHR(NS_E_NOMATCHING_ELEMENT),
        KNOWNHR(NS_E_NOT_CONFIGURED),

        KNOWNHR(DXVA2_E_NOT_INITIALIZED),   
        KNOWNHR(DXVA2_E_NEW_VIDEO_DEVICE),  
        KNOWNHR(DXVA2_E_VIDEO_DEVICE_LOCKED),
        KNOWNHR(DXVA2_E_NOT_AVAILABLE) 
    };
    const int KnownHResultCount = sizeof(KnownHResultList) / sizeof(KnownHResultList[0]);

    bool NameHResult(HRESULT hr, CString &str)
	{
		for (int i=0; i<KnownHResultCount; i++) {
			if (hr == KnownHResultList[i].hr) {
                str.Format(_T("%s (0x%08lX)"), KnownHResultList[i].name,hr);
				return true;
			}
		}

		str.Format(_T("Unknown HRESULT (0x%08lX)"), hr);
		return false;
	}

    bool InsertHresultLookup(int i, CListCtrl* pListCtrl)
    {
        if(i<0 || i >= KnownHResultCount) return false;

        int nIndex = pListCtrl->InsertItem(pListCtrl->GetItemCount(), KnownHResultList[i].name);
        if(nIndex == -1) return false;

        CStringArray* arrData = new CStringArray();
        arrData->Add(KnownHResultList[i].name);

        HRESULT hr = KnownHResultList[i].hr;
        CString val;
        val.Format(_T("0x%08lX"), hr);
        pListCtrl->SetItemText(nIndex, 1, val);
        arrData->Add(val);
        val.Format(_T("%d"), hr);
        pListCtrl->SetItemText(nIndex, 2, val);
        arrData->Add(val);

        TCHAR szErr[MAX_ERROR_TEXT_LEN];
        DWORD res = AMGetErrorText(KnownHResultList[i].hr, szErr, MAX_ERROR_TEXT_LEN);
        if (res == 0)
        {
            _com_error error(hr);
            pListCtrl->SetItemText(nIndex, 3, error.ErrorMessage());
            arrData->Add(error.ErrorMessage());
        }
        else
        {
            CString errStr;
            errStr.Format(TEXT("%s"), szErr);
            pListCtrl->SetItemText(nIndex, 3, errStr);
            arrData->Add(errStr);
        }

        pListCtrl->SetItemData(nIndex, (DWORD_PTR)arrData);

        return true;
    }

};


